{*  $count_pages - liczba wszystich dostępnych stron *}
{*  $actual_page - numer aktualnie wyświetlanej strony *}
{*  $pagination_link - link zawierający wszystkie zmienne z wyszukiwarki bez numeru strony *}
{*	!!!cośtam!!! oznacza aktualną stronę *}
<div id="pagination">
	{* {assign var=count_pages value=12} *}
	


{if $actual_page>'1'}<a href="{$pagination_link}&page={$actual_page-1}">Poprzednia&nbsp;</a>{/if}
{if $count_pages > '10'}

	{section name=pages start=1 loop=4 step=1}
		{if $smarty.section.pages.index <= $count_pages}
			{if $smarty.section.pages.index == $actual_page}
				<span class="actualPage">{$smarty.section.pages.index}</span>
			{else}
				<a href="{$pagination_link}&page={$smarty.section.pages.index}">{$smarty.section.pages.index}</a>
			{/if}	
				
		{/if}
	{/section}
	{if $actual_page > '6'}
	...
	{/if}
	{section name=pages start=$actual_page-2 loop=$actual_page+3 step=1}
		{if $smarty.section.pages.index <= $count_pages && $smarty.section.pages.index>3 }
			{if $smarty.section.pages.index == $actual_page}
				<span class="actualPage">{$smarty.section.pages.index}</span>
			{else}
				<a href="{$pagination_link}&page={$smarty.section.pages.index}">{$smarty.section.pages.index}</a>
			{/if}	
				
		{/if}
	{/section}
	{if $actual_page < $count_pages-4}
	...
	{/if}
	{section name=pages start=$count_pages-2 loop=$count_pages+1 step=1}
		{if $smarty.section.pages.index > $actual_page+2}
			{if $smarty.section.pages.index == $actual_page}
				<span class="actualPage">{$smarty.section.pages.index}</span>
			{else}
				<a href="{$pagination_link}&page={$smarty.section.pages.index}">{$smarty.section.pages.index}</a>
			{/if}	
				
		{/if}
	{/section}
	
{else}
	{section name=pages start=1 loop=10 step=1}
		{if $smarty.section.pages.index <= $count_pages}
			{if $smarty.section.pages.index == $actual_page}
				<span class="actualPage">{$smarty.section.pages.index}</span>
			{else}
				<a href="{$pagination_link}&page={$smarty.section.pages.index}">{$smarty.section.pages.index}</a>
			{/if}	
				
		{/if}
	{/section}
{/if}	

{if $actual_page < $count_pages }<a href="{$pagination_link}&page={$actual_page+1}">&nbsp;Następna</a>{/if}
&nbsp;
strona {$actual_page} z {$count_pages}
<div class="clear"></div>
</div>